
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_Hans">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>contrib 包 &#8212; Django 3.2.6.dev 文档</title>
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../_static/language_data.js"></script>
    <link rel="index" title="索引" href="../../genindex.html" />
    <link rel="search" title="搜索" href="../../search.html" />
    <link rel="next" title="Django 管理站点" href="admin/index.html" />
    <link rel="prev" title="点击劫持保护" href="../clickjacking.html" />



 
<script src="../../templatebuiltins.js"></script>
<script>
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);</script>

  </head><body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../../index.html">Django 3.2.6.dev 文档</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../../index.html">Home</a>  |
        <a title="Table of contents" href="../../contents.html">Table of contents</a>  |
        <a title="Global index" href="../../genindex.html">Index</a>  |
        <a title="Module index" href="../../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="../clickjacking.html" title="点击劫持保护">previous</a>
     |
    <a href="../index.html" title="API 参考" accesskey="U">up</a>
   |
    <a href="admin/index.html" title="Django 管理站点">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="ref-contrib-index">
            
  <div class="section" id="s-contrib-packages">
<span id="contrib-packages"></span><h1><code class="docutils literal notranslate"><span class="pre">contrib</span></code> 包<a class="headerlink" href="#contrib-packages" title="永久链接至标题">¶</a></h1>
<p>Django 旨在遵循 Python 的 <a class="reference external" href="https://docs.python.org/3/tutorial/stdlib.html#tut-batteries-included" title="(在 Python v3.9)"><span class="xref std std-ref">“功能完备” 的理念</span></a>。它提供了各种额外的、可选择的工具来解决常见的 Web 开发问题。</p>
<p>这段代码位于 Django 发行版中的 <code class="docutils literal notranslate"><span class="pre">django/contrib</span></code> 中。本文档给出了 <code class="docutils literal notranslate"><span class="pre">contrib</span></code> 中的包的概要，以及这些包的依赖关系。</p>
<div class="admonition-note admonition">
<p class="first admonition-title">注解</p>
<p class="last">对于大多数这些附加组件 —— 特别是包括模型或模板标签的附加组件 —— 你需要在你的 <a class="reference internal" href="../settings.html#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a> 配置中添加包名（例如 <code class="docutils literal notranslate"><span class="pre">'django.contrib.redirects'</span></code>），并重新运行 <code class="docutils literal notranslate"><span class="pre">manage.py</span> <span class="pre">migrate</span></code>。</p>
</div>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="admin/index.html">Django 管理站点</a></li>
<li class="toctree-l1"><a class="reference internal" href="auth.html"><code class="docutils literal notranslate"><span class="pre">django.contrib.auth</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="contenttypes.html">内容类型框架</a></li>
<li class="toctree-l1"><a class="reference internal" href="flatpages.html">简单页面应用</a></li>
<li class="toctree-l1"><a class="reference internal" href="gis/index.html">GeoDjango</a></li>
<li class="toctree-l1"><a class="reference internal" href="humanize.html"><code class="docutils literal notranslate"><span class="pre">django.contrib.humanize</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="messages.html">消息框架</a></li>
<li class="toctree-l1"><a class="reference internal" href="postgres/index.html"><code class="docutils literal notranslate"><span class="pre">django.contrib.postgres</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="redirects.html">重定向应用</a></li>
<li class="toctree-l1"><a class="reference internal" href="sitemaps.html">站点地图框架</a></li>
<li class="toctree-l1"><a class="reference internal" href="sites.html">“站点”框架</a></li>
<li class="toctree-l1"><a class="reference internal" href="staticfiles.html"><code class="docutils literal notranslate"><span class="pre">staticfiles</span></code> 应用</a></li>
<li class="toctree-l1"><a class="reference internal" href="syndication.html">Feed 聚合框架</a></li>
</ul>
</div>
<div class="section" id="s-admin">
<span id="admin"></span><h2><code class="docutils literal notranslate"><span class="pre">admin</span></code><a class="headerlink" href="#admin" title="永久链接至标题">¶</a></h2>
<p>Django 自动管理界面。更多信息请参见 <a class="reference internal" href="../../intro/tutorial02.html"><span class="doc">教程 2</span></a> 和 <a class="reference internal" href="admin/index.html"><span class="doc">管理文档</span></a>。</p>
<p>需要安装 <a class="reference internal" href="#auth">auth</a> 和 <a class="reference internal" href="#contenttypes">contenttypes</a> contrib 包。</p>
</div>
<div class="section" id="s-auth">
<span id="auth"></span><h2><code class="docutils literal notranslate"><span class="pre">auth</span></code><a class="headerlink" href="#auth" title="永久链接至标题">¶</a></h2>
<p>Django 的认证框架。</p>
<p>参见 <a class="reference internal" href="../../topics/auth/index.html"><span class="doc">User authentication in Django</span></a>。</p>
</div>
<div class="section" id="s-contenttypes">
<span id="contenttypes"></span><h2><code class="docutils literal notranslate"><span class="pre">contenttypes</span></code><a class="headerlink" href="#contenttypes" title="永久链接至标题">¶</a></h2>
<p>一个轻量级的框架，用于钩入 “多种类型” 的内容，每个安装的 Django 模型都是一个独立的内容类型。</p>
<p>参见 <a class="reference internal" href="contenttypes.html"><span class="doc">contenttypes 文档</span></a>。</p>
</div>
<div class="section" id="s-flatpages">
<span id="flatpages"></span><h2><code class="docutils literal notranslate"><span class="pre">flatpages</span></code><a class="headerlink" href="#flatpages" title="永久链接至标题">¶</a></h2>
<p>一个在数据库中管理 “简单” HTML 内容的框架。</p>
<p>参见 <a class="reference internal" href="flatpages.html"><span class="doc">简单页面文档</span></a>。</p>
<p>需要同时安装 <a class="reference internal" href="#sites">sites</a> contrib 包。</p>
</div>
<div class="section" id="s-gis">
<span id="gis"></span><h2><code class="docutils literal notranslate"><span class="pre">gis</span></code><a class="headerlink" href="#gis" title="永久链接至标题">¶</a></h2>
<p>一个建立在 Django 之上的世界级地理空间框架，可以实现空间数据的存储、操作和显示。</p>
<p>参见 <a class="reference internal" href="gis/index.html"><span class="doc">GeoDjango</span></a> 文档。</p>
</div>
<div class="section" id="s-humanize">
<span id="humanize"></span><h2><code class="docutils literal notranslate"><span class="pre">humanize</span></code><a class="headerlink" href="#humanize" title="永久链接至标题">¶</a></h2>
<p>一套 Django 模板过滤器，用于为数据添加 “人情味”。</p>
<p>参见 <a class="reference internal" href="humanize.html"><span class="doc">人性化文档</span></a>。</p>
</div>
<div class="section" id="s-messages">
<span id="messages"></span><h2><code class="docutils literal notranslate"><span class="pre">messages</span></code><a class="headerlink" href="#messages" title="永久链接至标题">¶</a></h2>
<p>一个存储和检索基于 cookie 或会话的临时消息的框架。</p>
<p>参见 <a class="reference internal" href="messages.html"><span class="doc">消息文档</span></a>。</p>
</div>
<div class="section" id="s-postgres">
<span id="postgres"></span><h2><code class="docutils literal notranslate"><span class="pre">postgres</span></code><a class="headerlink" href="#postgres" title="永久链接至标题">¶</a></h2>
<p>一个 PostgreSQL 特定功能的集合。</p>
<p>参见 <a class="reference internal" href="postgres/index.html"><span class="doc">contrib.postgres 文档</span></a>。</p>
</div>
<div class="section" id="s-redirects">
<span id="redirects"></span><h2><code class="docutils literal notranslate"><span class="pre">redirects</span></code><a class="headerlink" href="#redirects" title="永久链接至标题">¶</a></h2>
<p>一个管理重定向的框架。</p>
<p>参见 <a class="reference internal" href="redirects.html"><span class="doc">重定向文档</span></a>。</p>
</div>
<div class="section" id="s-sessions">
<span id="sessions"></span><h2><code class="docutils literal notranslate"><span class="pre">sessions</span></code><a class="headerlink" href="#sessions" title="永久链接至标题">¶</a></h2>
<p>一个在匿名会话中存储数据的框架。</p>
<p>参见 <a class="reference internal" href="../../topics/http/sessions.html"><span class="doc">会话文档</span></a>。</p>
</div>
<div class="section" id="s-sites">
<span id="sites"></span><h2><code class="docutils literal notranslate"><span class="pre">sites</span></code><a class="headerlink" href="#sites" title="永久链接至标题">¶</a></h2>
<p>一个轻量级的框架，可以让你在同一个数据库和 Django 安装下操作多个网站。它为你提供了将对象关联到一个或多个网站的钩子。</p>
<p>参见 <a class="reference internal" href="sites.html"><span class="doc">站点文档</span></a>。</p>
</div>
<div class="section" id="s-sitemaps">
<span id="sitemaps"></span><h2><code class="docutils literal notranslate"><span class="pre">sitemaps</span></code><a class="headerlink" href="#sitemaps" title="永久链接至标题">¶</a></h2>
<p>一个用于生成 Google 网站地图 XML 文件的框架。</p>
<p>参见 <a class="reference internal" href="sitemaps.html"><span class="doc">站点地图文档</span></a>。</p>
</div>
<div class="section" id="s-syndication">
<span id="syndication"></span><h2><code class="docutils literal notranslate"><span class="pre">syndication</span></code><a class="headerlink" href="#syndication" title="永久链接至标题">¶</a></h2>
<p>以 RSS 和 Atom 形式很容易地生成聚合 feed 的框架。</p>
<p>参见 <a class="reference internal" href="syndication.html"><span class="doc">聚合框架文档</span></a>。</p>
</div>
<div class="section" id="s-other-add-ons">
<span id="other-add-ons"></span><h2>其他附加功能<a class="headerlink" href="#other-add-ons" title="永久链接至标题">¶</a></h2>
<p>如果你有一个关于 <code class="docutils literal notranslate"><span class="pre">contrib</span></code> 的功能的想法，请告诉我们！把它写成代码，并发布到 <a class="reference internal" href="../../internals/mailing-lists.html#django-users-mailing-list"><span class="std std-ref">django-users</span></a> 邮件列表。</p>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../contents.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">contrib</span></code> 包</a><ul>
<li><a class="reference internal" href="#admin"><code class="docutils literal notranslate"><span class="pre">admin</span></code></a></li>
<li><a class="reference internal" href="#auth"><code class="docutils literal notranslate"><span class="pre">auth</span></code></a></li>
<li><a class="reference internal" href="#contenttypes"><code class="docutils literal notranslate"><span class="pre">contenttypes</span></code></a></li>
<li><a class="reference internal" href="#flatpages"><code class="docutils literal notranslate"><span class="pre">flatpages</span></code></a></li>
<li><a class="reference internal" href="#gis"><code class="docutils literal notranslate"><span class="pre">gis</span></code></a></li>
<li><a class="reference internal" href="#humanize"><code class="docutils literal notranslate"><span class="pre">humanize</span></code></a></li>
<li><a class="reference internal" href="#messages"><code class="docutils literal notranslate"><span class="pre">messages</span></code></a></li>
<li><a class="reference internal" href="#postgres"><code class="docutils literal notranslate"><span class="pre">postgres</span></code></a></li>
<li><a class="reference internal" href="#redirects"><code class="docutils literal notranslate"><span class="pre">redirects</span></code></a></li>
<li><a class="reference internal" href="#sessions"><code class="docutils literal notranslate"><span class="pre">sessions</span></code></a></li>
<li><a class="reference internal" href="#sites"><code class="docutils literal notranslate"><span class="pre">sites</span></code></a></li>
<li><a class="reference internal" href="#sitemaps"><code class="docutils literal notranslate"><span class="pre">sitemaps</span></code></a></li>
<li><a class="reference internal" href="#syndication"><code class="docutils literal notranslate"><span class="pre">syndication</span></code></a></li>
<li><a class="reference internal" href="#other-add-ons">其他附加功能</a></li>
</ul>
</li>
</ul>

  <h4>上一个主题</h4>
  <p class="topless"><a href="../clickjacking.html"
                        title="上一章">点击劫持保护</a></p>
  <h4>下一个主题</h4>
  <p class="topless"><a href="admin/index.html"
                        title="下一章">Django 管理站点</a></p>
  <div role="note" aria-label="source link">
    <h3>本页</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/ref/contrib/index.txt"
            rel="nofollow">显示源代码</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>快速搜索</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="转向" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">7月 23, 2021</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="../clickjacking.html" title="点击劫持保护">previous</a>
     |
    <a href="../index.html" title="API 参考" accesskey="U">up</a>
   |
    <a href="admin/index.html" title="Django 管理站点">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>